package com.us.example.config;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.*;
import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author:ChenSheng
 * @Description:
 * @Date: Created in 上午 9:55 2018/6/12 0012
 */
public class GeneratePass {
    public static void main(String[] args) {
        /*String password = "zop";  //$2a$10$Avw3ygiczX9IqmqiEDe9Hu4nscJnLIvsCFvjF7oEMCDmjop54cneS
        //String password = "abel";     //$2a$10$vsPRQiczsXRaihw1AwIPEOZqbTY4vfRhnujoIZ3by/e6aDofrPK7m
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        String hashedPassword = passwordEncoder.encode(password);
        System.out.println(hashedPassword);*/

        /*String idForEncode = "bcrypt";
        Map encoders = new HashMap<>();
        encoders.put(idForEncode, new BCryptPasswordEncoder());
        encoders.put("noop", NoOpPasswordEncoder.getInstance());
        encoders.put("pbkdf2", new Pbkdf2PasswordEncoder());
        encoders.put("scrypt", new SCryptPasswordEncoder());
        encoders.put("sha256", new StandardPasswordEncoder());

        PasswordEncoder passwordEncoder =
                new DelegatingPasswordEncoder(idForEncode, encoders);*/

        //admin--zop {bcrypt}$2a$10$Vh.XU7QZNcf9C8AxMr.Ar.rEXTdxzBD1oggaF/xKqCxKk2apfQ24m
        //abel--xop {bcrypt}$2a$10$3nuCvbW8Z4/tiWhbPq30BO9b8Kw26RDun.kZwQfwsuHpDvGaOmGDe

        /*PasswordEncoder passwordEncoder =
                PasswordEncoderFactories.createDelegatingPasswordEncoder();

        String encoded = passwordEncoder.encode("xop");
        System.out.println(encoded);*/
        List<String> s = new ArrayList<>();
        s.add("chen");
        s.add("wang");

        if(s.contains("chen")){
            System.out.println("-");
        }
    }
}
